﻿//Application is launched
application.onAppStart = function()
{
	/* Allow debugging */
	this.allowDebug = true;
}

//Client is connected
application.onConnect = function( client )
{
	
	//Accept the connection
	application.acceptConnection( client );
	
	//Call the function calledByServerSide from AS3
	application.clients[0].call( "calledByServerSide", null, "Hello Client :-)");
	
	// Define new client function for a nc.call().
	client.callFromClient = function( helloStr ) {
		return "Hello Mr " + helloStr + " :-D~";
	}
}

//Client disconnected
application.onDisconnect = function( client )
{
	//Trace on the FMS Application console 
	trace( client+" is disconnected" );
}